using System;
using System.Collections.Generic;
using System.Text;
using Bifrost;
using ZYCommon;

namespace TextEditor
{
    public class A_InsertCheckBox : A_Action
    {
        public override string ActionName()
        {
            return "checkbox";
        }

        public override bool UIExecute()
        {
            using (TextEditor.TextDocument.Control.frmCheckParam checkParam = new TextDocument.Control.frmCheckParam())
            {
                if (checkParam.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ZYTextCheck zc = new ZYTextCheck();
                    zc.OwnerDocument = base.myOwnerDocument;
                    zc.Text = checkParam.Content.Replace("\r\n", "\r");
                    zc.ID = checkParam.Id;
                    zc.Name = checkParam.CName;
                    base.myOwnerDocument._InsertElement(zc);
                }
            }
            return true;
        }

        public override bool isEnable()
        {
            return base.myOwnerDocument.CanModify();
        }
    }
}
